package com.spring.demos.ioccontainer.service.impl;

import com.spring.demos.ioccontainer.dao.FixedDepositDao;
import com.spring.demos.ioccontainer.pojo.FixedDepositDetails;
import com.spring.demos.ioccontainer.service.FixedDepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("fixedDepositService")
public class FixedDepositServiceImpl implements FixedDepositService {

    @Autowired
    private FixedDepositDao fixedDepositDao;

    public FixedDepositServiceImpl(FixedDepositDao fixedDepositDao) {
        this.fixedDepositDao = fixedDepositDao;
    }

    @Override
    public void saveDepositDetail(FixedDepositDetails fixedDepositDetails) {
        this.fixedDepositDao.saveDepositDetail(fixedDepositDetails);
    }

    @Override
    public FixedDepositDetails queryDepositById(String accountNum) {
        return fixedDepositDao.queryDepositById(accountNum);
    }

    @Override
    public void deleteDepositById(String accountNum) {
        fixedDepositDao.deleteDepositById(accountNum);
    }

    @Override
    public void saveMoney(String accountNum, float money) {
        fixedDepositDao.saveMoney(accountNum,money);
    }

    @Override
    public void getMoney(String accountNum, float money) {
        fixedDepositDao.getMoney(accountNum,money);
    }

    @Override
    public int[] batchSaveDepositDetails(List<FixedDepositDetails> fixedDepositDetailsList) {
        return fixedDepositDao.batchSaveDepositDetail(fixedDepositDetailsList);
    }
}
